<?php
namespace Admin\Controller;

class SinglePageController extends BaseController
{
    public function updateAction()
    {
        $SinglePage = M('SinglePage_About');
        if (IS_POST) {
            $data = $SinglePage->create($_POST['SinglePage_About']);
            if (false !== $data) {
                if (false !== $SinglePage->save()) {
                    $this->success('更新成功');
                } else {
                    $this->error('更新失败（失败原因：' . $SinglePage->getError() . '）');
                }
            } else {
                $this->error($SinglePage->getError());
            }
        } else {
            $page_info = $SinglePage->find(1);
            if (false === $page_info) {
                $this->error('获取信息失败！');
            }
            $this->assign('page_info', $page_info);
            $this->display();  
        }
    }
    
	/**
     * 编辑器上传处理
     */
	public function uploadJsonAction() 
    {
		$config = array(
			'savePath' => C('PICTURE_UPLOAD.rootPath')  . 'singlePage/',
            'subPath' => 'singlePage/',
		);
        vendor('Kindeditor.UploadJson', '', '.class.php');
		$UploadJson = new \UploadJson($config);
		$UploadJson->upload();
	}
    
	/**
     * 编辑器上传文件管理
     */
	public function fileManagerJson()
    {
		
	}
}